package JDBC1;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.Statement;

public class Demo{
    public static void main(String[] args) throws Exception {
        Class.forName("com.mysql.jdbc.Driver");
        Connection connection= DriverManager.getConnection("jdbc:mysql://localhost:3306/student","root","root");
        Statement statement=connection.createStatement();
        String sql1="INSERT INTO student(name,age,gander,address)VALUES(?,?,?,?)";
        PreparedStatement preparedStatement=connection.prepareStatement(sql1);
        preparedStatement.setString(1,"白志新");
        preparedStatement.setInt(2,200);
        preparedStatement.setString(3,"女");
        preparedStatement.setString(4,"浙江温州");
        int resultSet=preparedStatement.executeUpdate();
        System.out.println(resultSet);
        statement.close();
        connection.close();
    }
}
